﻿//  --------------------------------
//  Copyright (c) AW Systems, Inc. All rights reserved.
//  This source code is made available under the terms of the Microsoft Public License (Ms-PL)
//  http://www.codeplex.com/SLAM/license
//  ---------------------------------

using AWS.SLAM.Activation;
using AWS.SLAM.Events;
using AWS.SLAM.StructureMap;
using StructureMap.Configuration.DSL;

namespace AWS.SLAM.Hierarchy
{
    /// <summary>
    /// HierarchicalContentTypeTypeProfile defines the dependencies necessary for SLAM to
    /// process Content Types using the HierarchyPositionField and to hierarchically store
    /// List Items of a Content Type configured to be managed by SLAM.
    /// </summary>
    public class HierarchicalContentTypeTypeProfile : ITypeProfile
    {
        #region ITypeProfile Members

        /// <summary>
        /// Sets new dependencies in StructureMap for SLAM's IItemCreator, IItemDeleter, and IItemUpdater
        /// as a Profile with the given name to handle hierarchical Content Types.
        /// </summary>
        /// <param name="registry"></param>
        /// <param name="name"></param>
        public void CreateProfile(Registry registry, string name)
        {
            registry.CreateProfile(name).
                For<IItemCreator>().UseConcreteType<HierarchicalContentTypeItemCreator>().
                For<IItemDeleter>().UseConcreteType<HierarchicalContentTypeItemDeleter>().
                For<IItemUpdater>().UseConcreteType<HierarchicalContentTypeItemUpdater>().
                For<IDataSynchronizeTypeProcessor>().UseConcreteType<HierarchyDataSynchronizeTypeProcessor>();
        }

        #endregion

    }
}
